<?php
	if(isset($_SESSION["user"]) && $_SESSION["user"] == "admin")
	{
		$adc = new ActionDeCommunication($_GET[ID_ADC]);
		$adc->getOneADC();
		
		if(isset($_POST['Valider']))
		{
			foreach($adc->get_etudiants_ADC() as $etu)
				$noter[$etu->get_login()]=$_POST[$etu->get_login()];
			$_SESSION['note']=$noter;
			include('modules/administration/vues/confirmationNoterADC.php');
		}
		
		elseif(isset($_POST['Confirmer'])) // quand on valide la notation
		{
			foreach($adc->get_etudiants_ADC() as $etu)
				$adc->noter($etu->get_id(),$_SESSION["note"][$etu->get_login()]);
			
			$_SESSION["message"] = "Notation effectuée";
			header('Location: index.php?module=actionComm&action=detail&'.ID_ADC.'='.$_GET[ID_ADC].'&retour='.$_GET["retour"]);
		}
		
		elseif(isset($_POST['Modifier']))
		{
			include('modules/administration/vues/noterADC.php');
		}
		else			
			header('Location: index.php?module=actionComm&action=detail&'.ID_ADC.'='.$_GET[ID_ADC].'&retour='.$_GET["retour"]);// on retourne à l'adc
	}
	else
		include 'global/erreurConnexion.php';